			<?php use_helper('Date') ?>
			<?php use_helper('Number') ?>
			<?php include_javascripts_for_form($requestForm) ?>
			<?php use_helper('jQuery') ?>
			<?php use_helper('I18N'); ?>
<!-- wrap starts here -->
<div id="wrap">
	<div id="header"><div id="header-content">	
		<h1><?php echo link_to('Location de maisons et appartements avec piscine &agrave; Costa Brava', '@homepage', array('id'=>'logo')) ?></h1>
		<h2 id="slogan">Holidays Begur next to the sea</h2>		
		<?php $routeName = sfContext::getInstance()->getRouting()->getCurrentRouteName() ?>
		<ul id="header_flags_ul">
			<li><?php echo link_to(image_tag('/images/flag_ca.png'), '@location_show_ca'."?slug=".$vivienda->getSlug()."&sf_culture=ca", 'class=header_flags') ?></li>
			<li><?php echo link_to(image_tag('/images/flag_es.png'), '@location_show_es'."?slug=".$vivienda->getSlug()."&sf_culture=es", 'class=header_flags') ?></li>
			<li><?php echo link_to(image_tag('/images/flag_en.png'), '@location_show_en'."?slug=".$vivienda->getSlug()."&sf_culture=en", 'class=header_flags') ?></li>
			<li><?php echo link_to(image_tag('/images/flag_nl.png'), '@location_show_nl'."?slug=".$vivienda->getSlug()."&sf_culture=nl", 'class=header_flags') ?></li>
			<li><?php echo link_to(image_tag('/images/flag_fr.png'), '@location_show_fr'."?slug=".$vivienda->getSlug()."&sf_culture=fr", 'class=header_flags') ?></li>
			<li><?php echo link_to(image_tag('/images/flag_de.png'), '@location_show_de'."?slug=".$vivienda->getSlug()."&sf_culture=de", 'class=header_flags') ?></li>
		</ul>
		<!-- Menu Tabs -->
		<ul>
			<li><?php echo link_to(__("Home"), '@homepage') ?></li>
			<li><?php echo link_to(__("Location"), '@searcher_'.$sf_user->getLangCulture(), array('id'=>'current')) ?></li>
			<?php if(sfConfig::get('app_pestana_ofertas')): ?>
				<li><?php echo link_to(__("Ofertas"), '@ofertas_'.$sf_user->getLangCulture()) ?></li>
			<?php endif ?>
			<li><?php echo link_to('Begur', '@begur_'.$sf_user->getLangCulture()) ?></li>
			<li><?php echo link_to(__("WhoWeAre"), '@aboutus_'.$sf_user->getLangCulture()) ?></li>
		</ul>		
	</div>
</div>
		
	<!-- content-wrap starts here -->
	<div id="content-wrap">
		<div id="content">

			<div id="sidebar" >	

			<?php include_partial('global/suggestionsSidebar') ?>	
			
		</div>	
	
		<div id="main">		
<div id="breadcrumbs"><?php echo link_to(__("Home"), '@homepage') ?> > <?php echo link_to(__("Location"), '@searcher_'.$sf_user->getLangCulture()) ?>  > <?php echo ucwords($vivienda->getNombre()) ?></div>
	<?php if( $reserva != null) : ?>
	<div class="messages editPayForm">
	<p><?php echo __("postReservationOKMessage") ?><b><?php echo $reserva->getDsorder()."-".$reserva->getId() ?></b><p>
	</div>
	<?php endif ?>
		<?php if ($sf_user->hasFlash('refererComment')): ?>
				<p>
				<a href="<?php echo $sf_request->getReferer()."#".$vivienda->getId() ?>"> < <?php echo ucfirst(__("backTo", array('%0%'=>$sf_user->getFlash('refererComment')))) ?></a>
				<?php endif; ?>
			<div class="post">
				<h1><?php echo ucwords(ViviendaAlquiler::getSlugVivienda($vivienda->getApartCasa()))." ".ucwords($vivienda->getNombre()) ?>
				
				<span class="village"><span class="zone"><?php echo $vivienda->getZonas()->getZona().",</span> ".$vivienda->getZonas()->getLocalidades()->getLocalidad() ?></span></h1>
				</p>		
				<p class="parrafoAPartirPrecio">
				<?php if($vivienda->hasOfertaVivienda($vivienda)==1 && $vivienda->getViviendaMinPrecioOferta($vivienda) != 0): ?>
				<span class="aPartirPrecioOferta"><?php echo __("nowInOffer", array('%0%' => $vivienda->getViviendaMinPrecioOferta($vivienda))) ?></span>
				<?php else: ?>
					<?php if($vivienda->getViviendaMinPrecio($vivienda) != 0): ?>
					<span class="aPartirPrecio"><?php echo __("priceFrom", array('%0%' => $vivienda->getViviendaMinPrecio($vivienda))) ?></span>
					<?php endif ?>
				<?php endif ?>
				</p>	
				<?php if($vivienda->getDescRed($sf_user->getLangCulture()) != ""): ?>
				<blockquote><p>
					<?php echo $vivienda->getDescRed($sf_user->getLangCulture()) ?>
				</p></blockquote>
				<?php endif ?>

				<?php if (count($vivienda->getFoto()) > 0 && $vivienda->getGaleria()): ?>
				<p><?php echo image_tag(sfConfig::get('app_static_domain_fotos').$vivienda->getUsuarioId().'/'.$vivienda->getId().'/thumbs/'.$vivienda->getFoto()->get(0)->getNombrefoto(), ' width=100 height=75 style="float:left;" alt='.ucwords($vivienda->getSlug()).' '.$vivienda->getNombre()) ?></p>
				<?php else: ?>
				<p><?php echo image_tag('/fotos/oficina1.jpg', 'class=float-left width=100 height=75 style="float:left;" alt='.ucwords($vivienda->getSlug()).' '.$vivienda->getSlug()) ?></p>
				<?php endif; ?>
				<?php if (count($vivienda->getFoto()) > 1 && $vivienda->getGaleria()): ?>
				<p><?php echo image_tag(sfConfig::get('app_static_domain_fotos').$vivienda->getUsuarioId().'/'.$vivienda->getId().'/thumbs/'.$vivienda->getFoto()->get(1)->getNombrefoto(), 'style="clear:both;" class="float-left" width=100 height=75 alt='.ucwords($vivienda->getSlug()).' '.$vivienda->getNombre()) ?></p>
				<?php endif; ?>
				<div id="paragraphDesc"><?php echo html_entity_decode($vivienda->getDesc($sf_user->getLangCulture())) ?>
					<ul class="featuresVivienda">
						<li><?php echo __("desc_sleep", array('%0%' => $vivienda->getCapacidad())) ?>
						<li><?php echo __("desc_place", array('%0%' => $vivienda->getZonas()->getLocalidades()->getLocalidad())) ?><?php if($vivienda->getZonas() != ""): ?><?php echo __("desc_zona", array('%0%' => $vivienda->getZonas()->getZona())) ?><?php endif ?>
						</li>
						<?php if ($vivienda->getPiscina()>0): ?>
							<li><?php echo ucfirst(format_number_choice('[1]1 desc_swimpool|(1,+Inf] %1% desc_desc_swimpool', array('%1%' => $vivienda->getPiscina()), $vivienda->getPiscina())) ?></li>
						<?php endif ?>
						<?php if ($vivienda->getAseos()>0): ?>
							<li><?php echo format_number_choice('[1]1 desc_aseos|(1,+Inf] %1% desc_aseos', array('%1%' => $vivienda->getAseos()), $vivienda->getAseos()) ?></li>
						<?php endif ?>
						<?php if ($vivienda->getBanos()>0): ?>
				<li><?php echo format_number_choice('[1]1 desc_banos|(1,+Inf] %1% desc_banos', array('%1%' => $vivienda->getBanos()), $vivienda->getBanos()) ?></li>
						<?php endif ?>
						<?php if ($vivienda->getHabitaciones()>0): ?>
						<li><?php echo format_number_choice('[1]1 desc_rooms|(1,+Inf] %1% desc_rooms', array('%1%' => $vivienda->getHabitaciones()), $vivienda->getHabitaciones()) ?>
						<?php endif ?>
						
			<?php if($vivienda->hasSubHabEspecif()): ?>
			<?php echo __("habitaciones_distribuidas") ?>
						</li>
					<ul>
					<?php else: ?>
					</li>
					<?php endif ?>
					<?php if ($vivienda->getHabitacionesIndividual()>0): ?>
						<li><?php echo format_number_choice('[1]1 desc_ind_room|(1,+Inf] %1% desc_ind_room', array('%1%' => $vivienda->getHabitacionesIndividual()), $vivienda->getHabitacionesIndividual()) ?></li>
					<?php endif ?>
					<?php if ($vivienda->getHabitacionesMatrimonio()>0): ?>
						<li><?php echo format_number_choice('[1]1 desc_couple_room|(1,+Inf] %1% desc_couple_room', array('%1%' => $vivienda->getHabitacionesMatrimonio()), $vivienda->getHabitacionesMatrimonio()) ?></li>
					<?php endif ?>
					<?php if ($vivienda->getHabitacionesDoble()>0): ?>
						<li><?php echo format_number_choice('[1]1 desc_double_room|(1,+Inf] %1% desc_double_room', array('%1%' => $vivienda->getHabitacionesDoble()), $vivienda->getHabitacionesDoble()) ?></li>
					<?php endif ?>
					<?php if ($vivienda->getHabitacionesTriple()>0): ?>
						<li><?php echo format_number_choice('[1]1 desc_triple_room|(1,+Inf] %1% desc_triple_room', array('%1%' => $vivienda->getHabitacionesTriple()), $vivienda->getHabitacionesTriple()) ?></li>
					<?php endif ?>
					<?php if ($vivienda->getHabitacionesOtras()>0): ?>
						<li><?php echo format_number_choice('[1]1 desc_other_room|(1,+Inf] %1% desc_other_room', array('%1%' => $vivienda->getHabitacionesOtras()), $vivienda->getHabitacionesOtras()) ?></li>
					<?php endif ?>
					<?php if($vivienda->hasSubHabEspecif()): ?>
					</ul>	
					<?php endif ?>
					<?php if ($vivienda->getCamasSupletorias()>0): ?>
						<li><?php echo format_number_choice('[1]1 desc_supl_bed|(1,+Inf] %1% desc_supl_bed', array('%1%' => $vivienda->getCamasSupletorias()), $vivienda->getCamasSupletorias()) ?></li>
					<?php endif ?>
				</ul>
				<?php if ($vivienda->hasExteriors()): ?>
				<div class="subCaract">
					<span class="subLocation"><?php echo __('desc_exterior') ?>: </span>
					<span><?php echo format_number_choice('[0] desc_garden|[1]1 desc_garden|(1,+Inf] %1% desc_garden', array('%1%' => $vivienda->getJardin()), $vivienda->getJardin()) ?></span>
					<span><?php echo format_number_choice('[0] desc_garage|[1]1 desc_garage|(1,+Inf] %1% desc_garage', array('%1%' => $vivienda->getGaraje()), $vivienda->getGaraje()) ?></span>
					<span><?php echo format_number_choice('[0] desc_parking|[1]1 desc_parking', array('%1%' => $vivienda->getParking()), $vivienda->getParking()) ?></span>
					<span><?php echo format_number_choice('[0] desc_terraza|[1]1 desc_terraza', array('%1%' => $vivienda->getTerraza()), $vivienda->getTerraza()) ?></span>
					<span><?php echo format_number_choice('[0] desc_muebles_jardin|[1]1 desc_muebles_jardin', array('%1%' => $vivienda->getMueblesjardin()), $vivienda->getMueblesjardin()) ?></span>
					<span><?php echo format_number_choice('[0] desc_barbacoa|[1]1 desc_barbacoa', array('%1%' => $vivienda->getBarbacoa()), $vivienda->getBarbacoa()) ?></span>
					<span><?php echo format_number_choice('[0] desc_vistas|[1]1 desc_vistas', array('%1%' => $vivienda->getVistas()), $vivienda->getVistas()) ?></span>
				</div>
				<?php endif ?>
				
				<?php if ($vivienda->hasInteriors()): ?>
					<div class="subCaract">
						<span class="subLocation"><?php echo __('desc_interior') ?>: </span>
						<span><?php echo format_number_choice('[0] desc_tv|[1]1 desc_tv', array('%1%' => $vivienda->getTv()), $vivienda->getTv()) ?></span>
						<span><?php echo format_number_choice('[0] desc_wifi|[1]1 desc_wifi', array('%1%' => $vivienda->getWifi()), $vivienda->getWifi()) ?></span>
						<span><?php echo format_number_choice('[0] desc_satelite|[1]1 desc_satelite', array('%1%' => $vivienda->getSatelite()), $vivienda->getSatelite()) ?></span>
						<span><?php echo format_number_choice('[0] desc_dvd|[1]1 desc_dvd', array('%1%' => $vivienda->getDvd()), $vivienda->getDvd()) ?></span>
						<span><?php echo format_number_choice('[0] desc_calefaccion|[1]1 desc_calefaccion', array('%1%' => $vivienda->getCalefaccion()), $vivienda->getCalefaccion()) ?></span>
						<span><?php echo format_number_choice('[0] desc_aire|[1]1 desc_aire', array('%1%' => $vivienda->getAire()), $vivienda->getAire()) ?></span>
						<span><?php echo format_number_choice('[0] desc_chimenea|[1]1 desc_chimenea', array('%1%' => $vivienda->getChimenea()), $vivienda->getChimenea()) ?></span>
					</div>
				<?php endif ?>
				
				<?php if ($vivienda->hasCuinaNeteja()): ?>
			<div class="subCaract">
				<span class="subLocation"><?php echo __('desc_kitchen') ?>: </span>
				<span><?php echo format_number_choice('[0] desc_microondas|[1]1 desc_microondas', array('%1%' => $vivienda->getMicroondas()), $vivienda->getMicroondas()) ?></span>
				<span><?php echo format_number_choice('[0] desc_tostadora|[1]1 desc_tostadora', array('%1%' => $vivienda->getTostadora()), $vivienda->getTostadora()) ?></span>
				<span><?php echo format_number_choice('[0] desc_cafetera|[1]1 desc_cafetera', array('%1%' => $vivienda->getCafetera()), $vivienda->getCafetera()) ?></span>
			    <span><?php echo format_number_choice('[0] desc_plancha|[1]1 desc_plancha', array('%1%' => $vivienda->getPlancha()), $vivienda->getPlancha()) ?></span>
			    <span><?php echo format_number_choice('[0] desc_lavavajillas|[1]1 desc_lavavajillas', array('%1%' => $vivienda->getLavavajillas()), $vivienda->getLavavajillas()) ?></span>
			    <span><?php echo format_number_choice('[0] desc_lavadora|[1]1 desc_lavadora', array('%1%' => $vivienda->getLavadora()), $vivienda->getLavadora()) ?></span>
			</div>
			<?php endif ?>
					<?php if($vivienda->hasOfertaVivienda($vivienda)==1): ?>
						<div class="nowOfferFrom"><?php echo __("nowInOffer", array('%0%' => $vivienda->getViviendaMinPrecioOferta($vivienda))) ?></div>
					<?php endif ?>
					<div class="diaLlegadaSalida"><?php echo __("diaLlegada") ?>:  <?php echo  __($vivienda->getDiaSemanaCambio()) ?></div>
					<p class="post-footer" id="post-footer-location">	
					<?php if($precioMinimo > 0): ?>
					<?php include_component('location', 'viviendaFeatures', array('vivienda'=>$vivienda, 'precioMinimo'=>$precioMinimo)) ?>
					<?php else: ?>
					<?php include_component('location', 'viviendaFeatures', array('vivienda'=>$vivienda)) ?>
					<?php endif; ?>
					</p>
				</div>
						

<div class="tabs">
        <ul class="tabNavigation">
		<?php if(count($vivienda->getFoto())>0 && $vivienda->getGaleria()): ?>
            <li><a class="fotosTab" href="#fotos"><?php echo ucwords(__("photos")) ?></a></li>
		<?php endif; ?>
			<li><a id="tabMap" class="localisationTab" href="#mapt"><?php echo ucwords(__("localization")) ?></a></li>
			<?php if($vivienda->getUsuario()->getPagoonline() == 1 && $vivienda->getPagoonline()): ?>
			<li><a class="datesprixTab" href="#datesprix"><?php echo ucwords(__("bookOnline")) ?></a></li>
			<?php else: ?>
			<li><a class="datesprixTab" href="#datesprix"><?php echo ucwords(__("dates")) ?><?php if (count($prices)>0): ?> <?php echo __("andPrices") ?><?php endif; ?></a></li>
			<?php endif ?>
			<li><a class="contacterTab" href="#contacter"><?php echo __("contactBook") ?></a></li>
			
			<li><a class="conditionsTab" href="#conditions"><?php echo __("termsAndConditions") ?></a></li>
        </ul>
		<?php if(count($vivienda->getFoto())>0 && $vivienda->getGaleria()): ?>
        <div id="fotos">
            <p>
			<!-- Start Advanced Gallery Html Containers -->
				<div id="gallery" class="content" style="width:405px;margin-bottom:40px;">
					<div id="controls" class="controls"></div>
					<div id="loading" class="loader"></div>
					<div id="slideshow" class="slideshow"></div>
					<div id="caption" class="embox"></div>
				</div>

				<div id="thumbs" class="navigation" >
					<ul class="thumbs noscript">
						<?php foreach($vivienda->getFoto() as $foto) : ?>
						<li>
							<a class="thumb" href="<?php echo (sfConfig::get('app_static_domain_fotos').$vivienda->getUsuarioId().'/'.$vivienda->getId().'/'.$foto->getNombrefoto()) ?>" title="<?php echo $foto->getCaption() ?>">
								<img src="<?php echo sfConfig::get('app_static_domain_fotos').$vivienda->getUsuarioId().'/'.$vivienda->getId().'/'.$foto->getNombrefoto() ?>" alt="" width="100px" height="75px"/>
							</a>
							<div class="caption">
							
								<div class="image-title"><?php echo ucwords(ViviendaAlquiler::getSlugVivienda($vivienda->getApartCasa()))." ".ucwords($vivienda->getNombre()) ?></div>
								<?php if ($foto->getFotoCategoriaId()!=1): ?>
									<div><?php echo ucwords($foto->getFotoCategoria()->getFotoCategoriaDesc($sf_user->getLangCulture())) ?></div>
								<?php endif ?>
								<div class="image-desc"><?php echo $foto->getCaption() ?></div>
							</div>
						</li>
						<?php endforeach; ?>	
					</ul>
				</div>
				<!-- End Advanced Gallery Html Containers -->
			</p>
		</div>
		<?php endif; ?>
		
        <div id="mapt">
            <h2><?php echo __("MapAndHowtoarrive") ?></h2>
				<div><img src="/images/loadingMap.gif" /><div id="map" style="top:-25px;"></div></div>
				<div> 
					<b><?php echo __("HowtoarriveFrom") ?>: </b> 
					<input id="start" type="text" value="" style="width:65%"/> 
					<input type="button" value="<?php echo __("rutaButton") ?>" onclick="calcRoute()" class="button routeButton" /> 
				</div>
				<div id="directionsPanel"></div>
        </div>
		
        <div id="datesprix">					
	
	<form id="preus" action="<?php echo url_for('@iniciar_datos_reserva_'.$sf_user->getLangCulture()) ?>" method="get">	
		<?php if($vivienda->getUsuario()->getPagoonline() == 1 && $vivienda->getPagoonline()): ?>
			<?php include_component('location', 'tablaPrecioPagoonline', array('vivienda'=>$vivienda, 'prices'=>$prices)) ?>
		<?php else: ?>
			<?php include_component('location', 'tablaPrecioNoPagoonline', array('vivienda'=>$vivienda, 'prices'=>$prices)) ?>
		<?php endif ?>
	</form>
		
					<?php include_component('location', 'calendarVivienda', array('nombreVivienda'=>$vivienda)) ?>
			
			<div class="calenderLegende">
				<span class="bookedLeyenda"></span><?php echo __("noAvailability") ?><span class="bookedamLeyenda"></span><?php echo __("availabilityAfterMid") ?><span class="bookedpmLeyenda"></span><?php echo __("availabilityBeforeMid") ?>
				<!-- <span class="ofertaLeyenda"></span><?php echo __("offer") ?> -->
			</div>

		
		</p>
		</div>
		
        <div id="contacter">
            <p>		<div class="formContainer">
			
				<h3><?php echo __("askInfoOrContact") ?></h3>

<?php echo jq_form_remote_tag(array(
    'update'   => 'requestForm',
    'url'      => 'home/send',
	'script' => true,
	'loading'  => "$('.ajaxLoading').show()",
	'complete' => 'jQuery(function() {
				jQuery("#recepcion_emails_datainici").datepicker({showOn: "button", buttonImage: "/images/calendar.png", buttonImageOnly: true, dateFormat: "dd-mm-yy", numberOfMonths: 3, buttonText: "Selectionner la date",
					showButtonPanel: true, firstDay: 1, stepMonths: 3
				});				
				jQuery("#recepcion_emails_datafin").datepicker({beforeShow: customRange, showOn: "button", buttonImage: "/images/calendar.png", buttonImageOnly: true, dateFormat: "dd-mm-yy", numberOfMonths: 3, buttonText: "Selectionner la date",
					showButtonPanel: true, firstDay: 1, stepMonths: 3
				});	
				jQuery.datepicker.setDefaults(jQuery.datepicker.regional["<?php echo $sf_user->getLangCulture() ?>"]);
			});
			function customRange(input) {
				var min = $("#recepcion_emails_datainici").val();
				var format = $("#recepcion_emails_datainici").datepicker("option", "dateFormat");
				$(input).datepicker("option", "minDate",
				$.datepicker.parseDate(format, min));
			};',
)) ?>
<div id="requestForm">
<div style="clear:left;"><?php echo $requestForm['email']->renderRow() ?></div>
<div style="float:left; margin-right: 20px;"><?php echo $requestForm['datainici']->renderRow() ?></div>
<div style="float:left;"><?php echo $requestForm['datafin']->renderRow() ?></div>
<div style="clear:left;"><?php echo $requestForm['mensaje']->renderRow() ?></div>
<?php echo $requestForm['idioma']->render(array('value' =>  $sf_user->getLangCulture())) ?>
<?php echo $requestForm['vivienda']->render(array('value' => $vivienda->getNombre())) ?>
<?php echo $requestForm['fechahorarecepcion']->render() ?>
<?php echo $requestForm['ip']->render(array('value' => $sf_request->getHttpHeader('addr','remote'))) ?>
<?php echo $requestForm['casasvisitadas']->render(array('value' => $sf_user->getVisitedString())) ?>
<?php echo $requestForm['_csrf_token'] ?>
<input type="submit" value="<?php echo __('send') ?>" name="commit" id="contacterSubmit"/><span class="ajaxLoading"><?php echo __("pleaseWait") ?></span>
		
</div>
</form>
	 <script type="text/javascript">  
		jQuery(function() {
				if ($(":checkbox:checked").size() > 0){
						$('.buttonStartReservaSubmit').height($('.prices').height());
						$('#colReservar').css({opacity: 0.0, visibility: "visible"}).animate({opacity: 1.0});
				} else {
						$('#colReservar').css({opacity: 1.0, visibility: "visible"}).animate({opacity: 0.0});
				}
				$("#preus input[type=checkbox]").click(function(){
					if ($(this).is(':checked') && $(":checkbox:checked").size() == 1){
						$('.buttonStartReservaSubmit').height($('.prices').height());
						$('#colReservar').css({opacity: 0.0, visibility: "visible"}).animate({opacity: 1.0});
					} else {
						<!--Comprobamos si queda alguno checkeado para quitar boton Reservar -->
						if($(":checkbox:checked").size() == 0){
							$('#colReservar').css({opacity: 1.0, visibility: "visible"}).animate({opacity: 0.0});
						}
					}
				});
				$(".buttonStartReservaSubmit").click(function(){
					var ind = 0;
					var out = 0;
					$(":checkbox:checked").each( function(){
	                    $(this).each( function(){
	                        var val = $(this).attr("checked") ? null : "checked";
	                       var arrOrder = $(this).attr("value").split("-");
	                   	   if(ind!=0 && arrOrder[1]-1 != ind){
						     alert('<?php echo __("noPosibleReservaSemanasNoConsecutivas") ?>');
							 out = 1;
						     return false;
		                   }
	                       ind = arrOrder[1];
	                    });
	                });
					if(out == 1) return false;
				});
				
				jQuery("#recepcion_emails_datainici").datepicker({showOn: 'button', buttonImage: '/images/calendar.png', buttonImageOnly: true, dateFormat: 'dd-mm-yy', numberOfMonths: 3, buttonText: 'Selectionner la date',
					showButtonPanel: true, firstDay: 1, stepMonths: 3
				});				
				jQuery("#recepcion_emails_datafin").datepicker({beforeShow: customRange, showOn: 'button', buttonImage: '/images/calendar.png', buttonImageOnly: true, dateFormat: 'dd-mm-yy', numberOfMonths: 3, buttonText: 'Selectionner la date',
					showButtonPanel: true, firstDay: 1, stepMonths: 3
				});	
				jQuery.datepicker.setDefaults(jQuery.datepicker.regional["<?php echo $sf_user->getLangCulture() ?>"]);
			});
			function customRange(input) {
				var min = $("#recepcion_emails_datainici").val();
				var format = $("#recepcion_emails_datainici").datepicker('option', 'dateFormat');
				$(input).datepicker('option', 'minDate',
				$.datepicker.parseDate(format, min));
		};
		<?php if($vivienda->getGeolongitud()!="" && $vivienda->getGeolatitud()!=""): ?>
			var directionsDisplay;
			var directionsService;
			function loadMaps(){
				//AJAX API is loaded successfully. Now lets load the maps api
				google.load("maps", "3", {"callback" : mapLoaded, "other_params" : 'sensor=false&libraries=places&language=<?php echo $sf_user->getLangCulture() ?>'});
			}
			function mapLoaded(){
				var myOptions = {
					zoom: <?php echo $vivienda->getGeoZoom() ?>,
					center: new google.maps.LatLng(<?php echo $vivienda->getGeolatitud() ?>, <?php echo $vivienda->getGeolongitud() ?>),
					scrollwheel: false,
					navigationControl: true,
					scaleControl: true,
					mapTypeId: google.maps.MapTypeId.ROADMAP
				}
				directionsService = new google.maps.DirectionsService();
				var infoWindow = new google.maps.InfoWindow();
				directionsDisplay = new google.maps.DirectionsRenderer();
				var map = new google.maps.Map(document.getElementById("map"), myOptions);
				directionsDisplay.setMap(map);
				directionsDisplay.setPanel(document.getElementById("directionsPanel"));
				var point = new google.maps.LatLng(<?php echo $vivienda->getGeolatitud() ?>, <?php echo $vivienda->getGeolongitud() ?>, <?php echo $vivienda->getGeoZoom() ?>);
				var autocomplete = new google.maps.places.Autocomplete(document.getElementById("start"));
				autocomplete.bindTo('bounds', map);
				var gmText = '<div style="float:left;margin-right:3px;"><div style="text-decoration:underline;"><?php echo ucwords(ViviendaAlquiler::getSlugVivienda($vivienda->getApartCasa()))." ".ucwords($vivienda->getNombre()) ?></div><div><?php echo "<strong>".$vivienda->getZonas()->getLocalidades()->getLocalidad() ?></strong> <?php if($vivienda->getZonas()->getZona()!="")echo "(".$vivienda->getZonas()->getZona().")" ?></div><div><?php echo __("desc_sleep_gmaps", array('%0%' => $vivienda->getCapacidad())) ?></div></div>';
				var marker = new google.maps.Marker({
				  position: point, 
				  map: map, 
				  title: '<?php echo ucwords(ViviendaAlquiler::getSlugVivienda($vivienda->getApartCasa()))." ".ucwords($vivienda->getNombre()) ?>'
				});
				
				<?php if (count($vivienda->getFoto()) > 1 && $vivienda->getGaleria()): ?>
				gmText = gmText+'<img height="55" width="75" src="<?php echo sfConfig::get('app_static_domain_fotos').$vivienda->getUsuarioId().'/'.$vivienda->getId().'/thumbs/'.$vivienda->getFoto()->get(0)->getNombrefoto() ?>" alt="" />';				
				<?php endif ?>
				
		
		function closeInfoWindow() {
			infoWindow.close();
		}
		 
		function openInfoWindow(marker, content) {
			var markerLatLng = marker.getPosition();
			infoWindow.setContent(gmText);
			infoWindow.open(map, marker);
		}

		google.maps.event.addListener(map, 'click', function(){
					closeInfoWindow();
		});
		google.maps.event.addListener(marker, 'click', function(){
            openInfoWindow(marker, "Marker");
        });
		openInfoWindow(marker, "Marker");
		}		 
			 function loadAPI(){
				if ($flagMaps){
					var script = document.createElement("script");
					script.src = "http://www.google.com/jsapi?key=<?php echo sfConfig::get('app_googlemaps_key') ?>&callback=loadMaps";
					script.type = "text/javascript";
					document.getElementsByTagName("head")[0].appendChild(script);
				}
				$flagMaps = false;
			}
			<?php endif ?>
	
			
		function translate($element) {
			google.language.translate($element.html(), "es", "<?php echo $sf_user->getLangCulture() ?>", function(result) {
			  if (!result.error) {
				$element.text(HtmlDecode(result.translation)) ;
			  }
			});
		}
		function HtmlDecode(text) {
			return $('<div/>').html(text).text();
		}

		jQuery(function() {
			$('.image-desc[text!=""]').each(function(index){
				if(jQuery.trim($(this).html()) != ''){
					translate($(this));
				}
			});
			
			$flagMaps = true;
				//setTimeout('loadAPI()', 2000);
			jQuery("#tabMap").click(function() {
					loadAPI();
			});
			$(".subCaract span:empty").each(function(index){
					$(this).remove();
				});

				$(".subCaract span:last-child").each(function(index){
					$(this).html($(this).html().slice(0,-1));
					$(this).html($(this).html()+".");
				});
		}); 
		
		function calcRoute() {
			var start = document.getElementById("start").value;
			var end =new google.maps.LatLng(<?php echo $vivienda->getGeolatitud() ?>, <?php echo $vivienda->getGeolongitud() ?>, <?php echo $vivienda->getGeoZoom() ?>);
			var request = {
				origin:start, 
				destination:end,
				travelMode: google.maps.DirectionsTravelMode.DRIVING
			};
			directionsService.route(request, function(response, status) {
			  if (status == google.maps.DirectionsStatus.OK) {
				directionsDisplay.setDirections(response);
			  }
			});
		}
		</script>
		
			</div></p>
        </div>
        <div id="conditions"><?php include_partial('aboutus/conditions_'.$sf_user->getLangCulture()) ?></div>
		<?php if ($sf_user->hasFlash('refererComment')): ?>
				<p class="rentrerRecherche"><a href="<?php echo $sf_request->getReferer()."#".$vivienda->getNombre() ?>"> < <?php echo ucwords(__("back")) ?>
				</a></p>
		<?php endif; ?>
</div>

				<div style="clear:both;">
					
				</div>
</div>